package com.zzyl.nursing.controller.member;

import com.zzyl.common.core.controller.BaseController;
import com.zzyl.common.core.domain.AjaxResult;
import com.zzyl.common.core.page.TableDataInfo;
import com.zzyl.nursing.dto.ProjectPageDTO;
import com.zzyl.nursing.service.ProjectService;
import com.zzyl.nursing.vo.ProjectPageVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * TODO
 *
 * @Author mr.luo
 * @Date 24 5月 2025 01:23
 */
@Api(tags = "护理项目")
@RestController
@RequestMapping("/member/orders/project")
public class ProjectController extends BaseController {
    @Autowired
    private ProjectService projectService;

    /**
     *  分页查询护理项目列表
     *
     * @param projectPageDTO
     * @return
     */
//    @ApiOperation(value = "分页查询护理项目列表")
//    @GetMapping("/page")
//    public TableDataInfo page(ProjectPageDTO projectPageDTO) {
//        startPage();
//        List<ProjectPageVO> projectPageVOS = projectService.page(projectPageDTO);
//        return getDataTable(projectPageVOS);
//    }
    @ApiOperation(value = "分页查询护理项目列表")
    @GetMapping("/page")
    public TableDataInfo page(ProjectPageDTO projectPageDTO) {
        TableDataInfo<ProjectPageVO> projectPageVOS = projectService.pageList(projectPageDTO);
        return projectPageVOS;
    }

    /**
     * 1.2 根据编号查询护理项目信息
     */
    @ApiOperation(value = "根据编号查询护理项目信息")
    @GetMapping("/{id}")
    public AjaxResult getById(@PathVariable Long id) {
        ProjectPageVO projectPageVO = projectService.getProjectById(id);
        return success(projectPageVO);
    }
}
